﻿using System.Runtime.Serialization;

namespace lucere.service.search
{
	/// <summary>
	/// Expert: Describes the score computation for document and query.
	/// </summary>
	public interface IExplanation : ISerializable
	{

		/// <summary>
		/// Indicates whether or not this Explanation models a good match.
		/// <p>
		/// By default, an Explanation represents a "match" if the value is positive.
		/// </p>
		/// <see cref="Value"></see>
		/// </summary>
		bool IsMatch();
		///<summary>
		/// Gets or sets the value assigned to this explanation node. 
		/// </summary>
		float Value { get; set; }

		/// <summary>
		/// Gets or sets a description of this explanation node. 
		/// </summary>
		string Description { get; set; }

		/// <summary>
		/// A short one line summary which should contain all high level 
		/// information about this Explanation, without the "Details"
		/// </summary>
		string Summary { get; }

		///<summary>
		/// The sub-nodes of this explanation node. 
		/// </summary>
		IExplanation[] Details { get; }

		///<summary>
		/// Adds a sub-node to this explanation node. 
		/// </summary>
		void AddDetail(IExplanation detail);

		///<summary>
		/// Render an explanation as HTML. 
		///</summary>
		string ToHtml();
	}
}